package org.thotheolh.sweatkeeper.db;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DbConnection {

	private String connPath = "";
	Connection conn = null;

	DbConnection(String connPath) {
		this.connPath = connPath;
	}

	Connection getConnection() {

		try {
			Class.forName("org.h2.Driver").newInstance();
			conn = DriverManager.getConnection(this.connPath, "sa", "");
		}
		catch (Exception ex) {
			ex.printStackTrace();
		}
		return conn;
	}

	void close() {
		if (conn != null) {
			try {
				conn.close();
			}
			catch (SQLException ex) {
			}
		}
	}
}
